/**
 * 左边工具栏
 * @author heke
 * @version 20170426
 */
const state = {
    menus: [
        // {
        //     type: 'dropdown', // dropdown | default | checkbox
        //     name: 'New',
        //     title: 'new form',
        //     icon: 'fa fa-fw fa-file-o',
        //     extraCls: 'btn-default',
        //     subMenus: [
        //         {
        //             type: 'default',
        //             name: 'Standard',
        //             title: 'new standard form',
        //             icon: 'fa fa-fw fa-file-text-o',
        //             extraCls: '',
        //             callback: 'newStandardForm'
        //         }
        //     ]
        // },
        {
            type: 'default',
            name: '新增行',
            title: '新增行',
            icon: 'fa fa-fw fa-cubes',
            extraClass: 'btn-default',
            callback: 'initRow'
        },
        {
            type: 'dropdown',
            name: '新增控件',
            title: '新增控件',
            icon: 'fa fa-fw fa-cube',
            extraClass: 'btn-default',
            subMenus: [
                {
                    type: 'default',
                    name: '文本输入框',
                    title: '文本输入框',
                    icon: 'fa fa-fw fa-file-text-o',
                    extraClass: '',
                    callback: ['initUnit', 'textboxUnit']
                },
                {
                    type: 'default',
                    name: '数字输入框',
                    title: '数字输入框',
                    icon: 'fa fa-fw fa-file-text-o',
                    extraClass: '',
                    callback: ['initUnit', 'numericTextboxUnit']
                },
                {
                    type: 'default',
                    name: '日期输入框',
                    title: '日期输入框',
                    icon: 'fa fa-fw fa-calendar',
                    extraClass: '',
                    callback: ['initUnit', 'datePickerUnit']
                }
            ]
        },
        {
            type: 'default',
            name: '复制',
            title: '复制',
            icon: 'fa fa-fw fa-files-o',
            extraClass: 'btn-default',
            callback: 'copy'
        },
        {
            type: 'default',
            name: '粘贴',
            title: '粘贴',
            icon: 'fa fa-fw fa-clipboard',
            extraClass: 'btn-default',
            callback: 'paste'
        },
        {
            type: 'default',
            name: '删除',
            title: '删除',
            icon: 'fa fa-fw fa-trash-o',
            extraClass: 'btn-default',
            callback: 'remove'
        }
    ]
}

const getters = {
    toolbarMenus: state => state.menus
}

const actions = {
    newStandardForm ({ commit }) {
        commit('NEW_STANDARD_FORM')
    }
}

const mutations = {
    'NEW_STANDARD_FORM' () {
        console.log('123')
    }
}

export default {
    state,
    getters,
    actions,
    mutations
}
